package com.fyw.kotlin.util

import java.io.Closeable
import java.io.IOException

/**
 * 关闭io 工具类
 * Created by FYW on 2017/9/28.
 */
object CloseIoUtils {
    fun closeIO(vararg closeables: Closeable) {
        if (closeables == null) return
        closeables
                .filterNotNull() //过滤非空元素
                .forEach {
                    try {
                        it!!.close()
                    } catch (e: IOException) {
                        e.printStackTrace()
                    }
                }
    }
}